<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>lwIP: src/core/ipv4/autoip.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">lwIP
   &#160;<span id="projectnumber">2.1.2</span>
   </div>
   <div id="projectbrief">Lightweight IP stack</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('autoip_8c.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">autoip.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="opt_8h.html">lwip/opt.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="mem_8h.html">lwip/mem.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="ip__addr_8h.html">lwip/ip_addr.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="netif_8h.html">lwip/netif.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="autoip_8h.html">lwip/autoip.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="lwip_2etharp_8h.html">lwip/etharp.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="prot_2autoip_8h.html">lwip/prot/autoip.h</a>&quot;</code><br />
<code>#include &lt;string.h&gt;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a634535156cc1a8cf9f04d3d5c74f8a59"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="autoip_8c.html#a634535156cc1a8cf9f04d3d5c74f8a59">LWIP_AUTOIP_RAND</a>(<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:a634535156cc1a8cf9f04d3d5c74f8a59"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acec75069f6e6ecbe200c5691e56ecd43"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="autoip_8c.html#acec75069f6e6ecbe200c5691e56ecd43">LWIP_AUTOIP_CREATE_SEED_ADDR</a>(<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:acec75069f6e6ecbe200c5691e56ecd43"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga2122c0b2518b371559fef5ec1d2aed90"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__autoip.html#ga2122c0b2518b371559fef5ec1d2aed90">autoip_set_struct</a> (struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>, struct <a class="el" href="structautoip.html">autoip</a> *<a class="el" href="structautoip.html">autoip</a>)</td></tr>
<tr class="separator:ga2122c0b2518b371559fef5ec1d2aed90"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1461f5826ebefc050e0d63013818d1e8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__autoip.html#ga1461f5826ebefc050e0d63013818d1e8">autoip_start</a> (struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:ga1461f5826ebefc050e0d63013818d1e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a11df7a20d52680cd8c1c18fba2b91e9e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="autoip_8c.html#a11df7a20d52680cd8c1c18fba2b91e9e">autoip_network_changed</a> (struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:a11df7a20d52680cd8c1c18fba2b91e9e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga58a4dce658dd1263e84eb982f62587d4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__autoip.html#ga58a4dce658dd1263e84eb982f62587d4">autoip_stop</a> (struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:ga58a4dce658dd1263e84eb982f62587d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a746fc1d7db1bf1617afae166c9d92c2d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="autoip_8c.html#a746fc1d7db1bf1617afae166c9d92c2d">autoip_tmr</a> (void)</td></tr>
<tr class="separator:a746fc1d7db1bf1617afae166c9d92c2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acaf2793325c60dc4531c21a3fd55c16e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="autoip_8c.html#acaf2793325c60dc4531c21a3fd55c16e">autoip_arp_reply</a> (struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>, struct <a class="el" href="structetharp__hdr.html">etharp_hdr</a> *hdr)</td></tr>
<tr class="separator:acaf2793325c60dc4531c21a3fd55c16e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1b4f0c53da17395d9de92a85708a1bb9"><td class="memItemLeft" align="right" valign="top">u8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="autoip_8c.html#a1b4f0c53da17395d9de92a85708a1bb9">autoip_supplied_address</a> (const struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:a1b4f0c53da17395d9de92a85708a1bb9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>AutoIP Automatic LinkLocal IP Configuration</p>
<p>This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform with RFC 3927. </p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="acec75069f6e6ecbe200c5691e56ecd43"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acec75069f6e6ecbe200c5691e56ecd43">&#9670;&nbsp;</a></span>LWIP_AUTOIP_CREATE_SEED_ADDR</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LWIP_AUTOIP_CREATE_SEED_ADDR</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><a class="el" href="structnetif.html">netif</a></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"><a class="code" href="def_8c.html#a14f94347a5b9b9e3602705b75b7ae524">lwip_htonl</a>(AUTOIP_RANGE_START + ((u32_t)(((u8_t)(<a class="code" href="structnetif.html">netif</a>-&gt;<a class="code" href="structnetif.html#aee967965d999fc1a4c40a66709304e69">hwaddr</a>[4])) | \</div><div class="line">                 ((u32_t)((u8_t)(<a class="code" href="structnetif.html">netif</a>-&gt;<a class="code" href="structnetif.html#aee967965d999fc1a4c40a66709304e69">hwaddr</a>[5]))) &lt;&lt; 8)))</div><div class="ttc" id="structnetif_html_aee967965d999fc1a4c40a66709304e69"><div class="ttname"><a href="structnetif.html#aee967965d999fc1a4c40a66709304e69">netif::hwaddr</a></div><div class="ttdeci">u8_t hwaddr[6U]</div><div class="ttdef"><b>Definition:</b> netif.h:341</div></div>
<div class="ttc" id="def_8c_html_a14f94347a5b9b9e3602705b75b7ae524"><div class="ttname"><a href="def_8c.html#a14f94347a5b9b9e3602705b75b7ae524">lwip_htonl</a></div><div class="ttdeci">u32_t lwip_htonl(u32_t n)</div><div class="ttdef"><b>Definition:</b> def.c:90</div></div>
<div class="ttc" id="structnetif_html"><div class="ttname"><a href="structnetif.html">netif</a></div><div class="ttdef"><b>Definition:</b> netif.h:260</div></div>
</div><!-- fragment --><p>Macro that generates the initial IP address to be tried by AUTOIP. If you want to override this, define it to something else in lwipopts.h. </p>

</div>
</div>
<a id="a634535156cc1a8cf9f04d3d5c74f8a59"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a634535156cc1a8cf9f04d3d5c74f8a59">&#9670;&nbsp;</a></span>LWIP_AUTOIP_RAND</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LWIP_AUTOIP_RAND</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><a class="el" href="structnetif.html">netif</a></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">( (((u32_t)((<a class="code" href="structnetif.html">netif</a>-&gt;<a class="code" href="structnetif.html#aee967965d999fc1a4c40a66709304e69">hwaddr</a>[5]) &amp; 0xff) &lt;&lt; 24) | \</div><div class="line">                                   ((u32_t)((<a class="code" href="structnetif.html">netif</a>-&gt;<a class="code" href="structnetif.html#aee967965d999fc1a4c40a66709304e69">hwaddr</a>[3]) &amp; 0xff) &lt;&lt; 16) | \</div><div class="line">                                   ((u32_t)((<a class="code" href="structnetif.html">netif</a>-&gt;<a class="code" href="structnetif.html#aee967965d999fc1a4c40a66709304e69">hwaddr</a>[2]) &amp; 0xff) &lt;&lt; 8) | \</div><div class="line">                                   ((u32_t)((<a class="code" href="structnetif.html">netif</a>-&gt;<a class="code" href="structnetif.html#aee967965d999fc1a4c40a66709304e69">hwaddr</a>[4]) &amp; 0xff))) + \</div><div class="line">                                   (netif_autoip_data(<a class="code" href="structnetif.html">netif</a>)? netif_autoip_data(<a class="code" href="structnetif.html">netif</a>)-&gt;tried_llipaddr : 0))</div><div class="ttc" id="structnetif_html_aee967965d999fc1a4c40a66709304e69"><div class="ttname"><a href="structnetif.html#aee967965d999fc1a4c40a66709304e69">netif::hwaddr</a></div><div class="ttdeci">u8_t hwaddr[6U]</div><div class="ttdef"><b>Definition:</b> netif.h:341</div></div>
<div class="ttc" id="structnetif_html"><div class="ttname"><a href="structnetif.html">netif</a></div><div class="ttdef"><b>Definition:</b> netif.h:260</div></div>
</div><!-- fragment --><p>Pseudo random macro based on netif informations. You could use "rand()" from the C Library if you define LWIP_AUTOIP_RAND in lwipopts.h </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="acaf2793325c60dc4531c21a3fd55c16e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acaf2793325c60dc4531c21a3fd55c16e">&#9670;&nbsp;</a></span>autoip_arp_reply()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void autoip_arp_reply </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetif.html">netif</a> *&#160;</td>
          <td class="paramname"><em>netif</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structetharp__hdr.html">etharp_hdr</a> *&#160;</td>
          <td class="paramname"><em>hdr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Handles every incoming ARP Packet, called by <a class="el" href="etharp_8c.html#a540a5506979693ef9ac4496db9bfa7d6">etharp_input()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">netif</td><td>network interface to use for autoip processing </td></tr>
    <tr><td class="paramname">hdr</td><td>Incoming ARP packet </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a11df7a20d52680cd8c1c18fba2b91e9e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a11df7a20d52680cd8c1c18fba2b91e9e">&#9670;&nbsp;</a></span>autoip_network_changed()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void autoip_network_changed </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetif.html">netif</a> *&#160;</td>
          <td class="paramname"><em>netif</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Handle a possible change in the network configuration.</p>
<p>If there is an AutoIP address configured, take the interface down and begin probing with the same address. </p>

</div>
</div>
<a id="a1b4f0c53da17395d9de92a85708a1bb9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1b4f0c53da17395d9de92a85708a1bb9">&#9670;&nbsp;</a></span>autoip_supplied_address()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u8_t autoip_supplied_address </td>
          <td>(</td>
          <td class="paramtype">const struct <a class="el" href="structnetif.html">netif</a> *&#160;</td>
          <td class="paramname"><em>netif</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>check if AutoIP supplied netif-&gt;<a class="el" href="structip__addr.html">ip_addr</a></p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">netif</td><td>the netif to check </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 if AutoIP supplied netif-&gt;<a class="el" href="structip__addr.html">ip_addr</a> (state BOUND or ANNOUNCING), 0 otherwise </dd></dl>

</div>
</div>
<a id="a746fc1d7db1bf1617afae166c9d92c2d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a746fc1d7db1bf1617afae166c9d92c2d">&#9670;&nbsp;</a></span>autoip_tmr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void autoip_tmr </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Has to be called in loop every AUTOIP_TMR_INTERVAL milliseconds </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_aebb8dcc11953d78e620bbef0b9e2183.html">core</a></li><li class="navelem"><a class="el" href="dir_a32e111ee6805cfc63488fd2d37f2390.html">ipv4</a></li><li class="navelem"><a class="el" href="autoip_8c.html">autoip.c</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
